
import java.io.*;
import java.sql.*;

import java.util.Iterator;
import java.util.Vector;

import oracle.jdbc.driver.OracleDriver;

public class Correlativos {

    int CCli;
    int CProv;
    int CMP;
    int CEPE;
    int CGas;

    void cClientes(){
      try{
        ConexionBD BD_con = new ConexionBD();
        Connection OJDBC_con = BD_con.DBConect();
        System.out.println("CONNECTED TO   ---> ");

        // Use the Connection to create a Statement object
        Statement STMT_comando = OJDBC_con.createStatement ();

        // Execute query using Statement, receive the ResultSet
        String STR_query ="SELECT MAX(cli_id) FROM tbm_clientes";
        ResultSet RS_datos = STMT_comando.executeQuery(STR_query);
        System.out.println("EXECUTED QUERY ---> " + STR_query);

        // Print the results, row by row
        System.out.println("\nPROCESSING RESULTS:\n");
        RS_datos.next();
        CCli = RS_datos.getInt("MAX(cli_id)");
        RS_datos.close();
        STMT_comando.close();
        OJDBC_con.close();

      } catch (SQLException e) {
        e.printStackTrace();
    }
   }

    void cProveedores(){
      try{
        ConexionBD BD_con = new ConexionBD();
        Connection OJDBC_con = BD_con.DBConect();
        System.out.println("CONNECTED TO   ---> ");

        // Use the Connection to create a Statement object
        Statement STMT_comando = OJDBC_con.createStatement ();

        // Execute query using Statement, receive the ResultSet
        String STR_query ="SELECT MAX(prov_id) FROM tbm_proveedores";
        ResultSet RS_datos = STMT_comando.executeQuery(STR_query);
        System.out.println("EXECUTED QUERY ---> " + STR_query);

        // Print the results, row by row
        System.out.println("\nPROCESSING RESULTS:\n");
        RS_datos.next();
        CProv = RS_datos.getInt("MAX(prov_id)");
        RS_datos.close();
        STMT_comando.close();
        OJDBC_con.close();

      } catch (SQLException e) {
        e.printStackTrace();
    }
   }

    void cMateriaPrima(){
      try{
        ConexionBD BD_con = new ConexionBD();
        Connection OJDBC_con = BD_con.DBConect();
        System.out.println("CONNECTED TO   ---> ");

        // Use the Connection to create a Statement object
        Statement STMT_comando = OJDBC_con.createStatement ();

        // Execute query using Statement, receive the ResultSet
        String STR_query ="SELECT MAX(mp_id) FROM tbm_inventario_materiaprima";
        ResultSet RS_datos = STMT_comando.executeQuery(STR_query);
        System.out.println("EXECUTED QUERY ---> " + STR_query);

        // Print the results, row by row
        System.out.println("\nPROCESSING RESULTS:\n");
        RS_datos.next();
        CMP = RS_datos.getInt("MAX(mp_id)");
        RS_datos.close();
        STMT_comando.close();
        OJDBC_con.close();

      } catch (SQLException e) {
        e.printStackTrace();
    }
   }

    void cEntregaPanel(){
        try {
            ConexionBD BD_Con = new ConexionBD();
            Connection OJDBC_Con = BD_Con.DBConect();
            //Create Statement for Query
            Statement St_objquery = OJDBC_Con.createStatement();
            //Creating String for Query
            String STR_query = "SELECT MAX(doce_id) FROM tbt_entregapanel_enc";
            ResultSet RS_datos = St_objquery.executeQuery(STR_query);
            RS_datos.next();
            CEPE = RS_datos.getInt("MAX(doce_id)");
            // Closing Connection
            RS_datos.close();
            St_objquery.close();
            OJDBC_Con.close();
        } catch (Exception e) {
            e.printStackTrace();
        }

    }


      public static void main(String[] args) {

          Correlativos c = new Correlativos ();
          c.cClientes();
          System.out.println(c.CCli);


      }
        void cGastos(){
      try{
        ConexionBD BD_con = new ConexionBD();
        Connection OJDBC_con = BD_con.DBConect();
        System.out.println("CONNECTED TO   ---> ");

        // Use the Connection to create a Statement object
        Statement STMT_comando = OJDBC_con.createStatement ();

        // Execute query using Statement, receive the ResultSet
        String STR_query ="SELECT MAX(docc_id) FROM tbt_compras_enc";
        ResultSet RS_datos = STMT_comando.executeQuery(STR_query);
        System.out.println("EXECUTED QUERY ---> " + STR_query);

        // Print the results, row by row
        System.out.println("\nPROCESSING RESULTS:\n");
        RS_datos.next();
        CGas = RS_datos.getInt("MAX(docc_id)");
        RS_datos.close();
        STMT_comando.close();
        OJDBC_con.close();

      } catch (SQLException e) {
        e.printStackTrace();
    }
   }

}
